import request from '@/router/axios'

export function getMenu(id,type) {
    let data = {};
    if(id != null){
        data.parentId = id;
    }
    if(type){
        data.systemType = type;
    }
    return request({
        url: '/sys/menu/getLeft',
        params: data,
        method: 'get'
    })
}

export function fetchMenuTree(lazy, parentId,systemType) {
    return request({
        url: '/admin/menu/tree',
        method: 'get',
        params: {lazy: lazy, parentId: parentId,systemType:systemType}
    })
}

export function addObj(obj) {
    return request({
        url: '/admin/menu',
        method: 'post',
        data: obj
    })
}

export function getObj(id) {
    return request({
        url: '/admin/menu/' + id,
        method: 'get'
    })
}

export function delObj(id) {
    return request({
        url: '/admin/menu/' + id,
        method: 'delete'
    })
}

export function putObj(obj) {
    return request({
        url: '/admin/menu',
        method: 'put',
        data: obj
    })
}
